import { getRequest, postRequest, getDownload, putRequest, deleteRequest } from '/src/lib/axios';

export const userApi = {
    // 表格数据查询
    getOrgsFetch: (param) => {
        return getRequest('/users/fetch', param);
    },
    // 树形
    getOrgsTree: () => {
        return getRequest('/orgs/tree');
    },
    // 新增
    getOrgsAdd: (param) => {
        return postRequest('/users/add', param);
    },
    // 编辑回显
    geteaitFetch: (id) => {
        return getRequest(`/users/get/${id}`);
    },
    // 编辑成功
    puteaitupdate: (param) => {
        return putRequest('/users/update/', param);
    },
    // 删除
    getdeleteFetch: (param) => {
        return getRequest('/users/delete', param);
    },
    // 密码生成
    getPasswordFetch: (param) => {
        return getRequest('/users/randomPassword', param);
    },
    // 密码提交
    getchangeFetch: (param) => {
        return putRequest('/users/changePassword', param);
    },
    //  密码重置
    getresetFetch: (param) => {
        return postRequest('/users/resetPassword', param)
    },
    // 岗位表格查询
    getPositionsFetch: (param) => {
        return getRequest('/users/posts/fetch', param)
    },
    // 岗位表格新增
    getpostaddFetch: (param) => {
        return postRequest('/users/posts/add', param)
    },
    // 岗位表格删除
    getdeleteapi: (param) => {
        return getRequest('/users/posts/delete?ids='+param);
    },
    // 兼职表格查询数据接口
    gethatsFetch: (param) => {
        return getRequest('/users/hats/fetch', param);
    },
    // 兼职表格add数据接口
    postaddFetch: (param) => {
        return postRequest('/users/hats/add', param)
    },
    // users/hats/add
    // 导出 maxkey-mgt-api/users/export/user resetPassword
    exportDownloadUser: () => {
        return getDownload('/users/export/user');
    },
    //模板下载 users/export/template
    usersDownload: () => {
        return getDownload('/users/export/template');
    },
    // 导入 maxkey-mgt-api/users/import
    usersImport: () => {
        return postRequest('/users/import');
    },

    // users/updateStatus?id=00000009&status=5 锁定
    //users/updateStatus?id=00000009&status=1 锁定
    // users/updateStatus?id=00000009&status=1 禁用
    // users/updateStatus?id=00000009&status=1 禁用
    updateStatus: (param) => {
        return getRequest('/users/updateStatus', param);
    },
    

    // /users/hats/get/1059556673934327808
    getUserHats(id) {
        return getRequest(`/users/hats/get/${id}`);
    },
    updateUserHats: (param) => {
        return putRequest('/users/hats/update', param);
    },
    deleteUserHats: (param) => {
        return deleteRequest('/users/hats/delete?ids=' + param);
    },

}; 
